 {include file="public/header" /}
    <div class="layui-container layui-margin-top-100" data-wow-duration='1.0s'>
        <div class="layui-row wow zoomInDown">
            <div class="layui-col-md12">
                <h1 class="text-color-yellow" style="margin-bottom: 20px;">零零诉案源库</h1>
                <div class="casebase-wraper layui-boder-all">
                    <div class="casebase-wraper-one"><span>以下仅为部分案源，成为零零诉合伙人将获得更多案源支持</span><button class="sub-btn" onclick='window.location.href="{:url('submitcase/index')}"'>提交案件</button></div>
                    <div class="casebase-wraper-two"><span>选择地址：</span>
                    <select name="casebase-city" id="shenfen">
                        <option value="" >省份</option>
                        {volist name="parent" id="vo"}
                             <option class="shenfenopt" value="{$vo.code}">{$vo.name}</option>
                        {/volist}
                    </select>
                    <select name="casebase-cuntry" id="citys">
                        <option value="" >城市</option>
                        {volist name="parent" id="vo"}
                            {volist name="$vo.son" id="vo2"}
                                    {if condition="$key eq 0"}
                                          <option  value="{$vo2.name}">{$vo2.name}</option>
                                    {/if}
                            {/volist}
                        {/volist}
                    </select>
                    </div>
                    <div class="casebase-wraper-three"><span class="casebase-fenlei">案件类型：</span>
                        <div class="casebase-wraper-three-inner">
                            <span class="casebase-fenlei-item" onclick="window.location.href='{url(/'casebase/index/')}'">全部</span>
                            {volist name="casecate" id="vo"}
                            <span class="casebase-fenlei-item leixing" id="{$vo.id}">{$vo.title}</span>
                            {/volist}
                        </div>
                </div>
                    <!-- casebaseitem-active-->
                    <div class="casebase-wraper-four">需求筛选：
                            <span class="casebase-fenlei-item" onclick="window.location.href='{url(/'casebase/index/')}'">全部</span>
                            <span class="casebase-fenlei-item" onclick="window.location.href='{url(/'casebase/index/')}?zaixian='+2">招标中</span>
                            <span class="casebase-fenlei-item" onclick="window.location.href='{url(/'casebase/index/')}?zaixian='+1">已结束</span>
                    </div>

                    <table class="layui-text-center" id="casebase-table">
                            <colgroup>
                              <col width="150">
                              <col width="200">
                              <col>
                            </colgroup>
                            <thead>
                              <tr>
                                <th>案件类型</th>
                                <th>被告</th>
                                <th>案件标的（万元）</th>
                                <th>管辖法院</th>
                                <th>申请日期</th>
                                <th>案件状态</th>
                              </tr>
                            </thead>
                            <tbody id="casebasetable">
                            {if condition="empty($case)"}
                            <td colspan="6">没有更多的案件！</td>
                            {/if}
                            {volist name="case" id="vo"}
                            <tr>
                                <td>{$vo.catetype.title}</td>
                                <td>{$vo.bname}</td>
                                <td>{$vo.money}</td>
                                <td>{$vo.court}</td>
                                <td>{$vo.create_at|mb_substr=0,10,'utf-8'}</td>
                                {if condition="$vo.status eq 2"}
                                <td><span class="tendering">招标中</span></td>
                                {else /}
                                <td><span class="tendering-end">已结束</span></td>
                                {/if}
                            </tr>
                            {/volist}
                            <!-- 底部分页开始 -->

                            <tr>
                                <td colspan="6">
                                    <div class="container text-center">
                                        <nav aria-label="Page navigation">
                                            <ul>
                                                {$page}
                                            </ul>
                                        </nav>
                                    </div>
                                </td>
                            </tr>

                            <!-- 底部分页结束 -->
                            </tbody>
                        </table>
                        <!-- 分页容器 -->

                </div>
            </div>
        </div>
    </div>

 <script>
     $(document).ready(function () {
         //ajax获取市级
         $("#shenfen").bind(".shenfenopt").click(function () {
             var code = $(this).val();
             $.ajax({
                 url: "{:url('index/city')}",
                 data:{code:code},
                 type: 'GET',
                 dataType: 'json',
                 timeout: 1000,
                 cache: false,
                 beforeSend: LoadFunction, //加载执行方法
                 error: erryFunction,  //错误执行方法
                 success: succFunction //成功执行方法
             })
             function LoadFunction() {
                 $("#citys").html('加载中...');
             }
             function erryFunction() {
                 alert("error");
             }
             function succFunction(data) {
                 $("#citys").html(' ');
                 var json = eval(data); //数组
                 var text = '<option>'+'城市'+'</option>';
                 for(var i=0;i<json.length;i++){
                     text+='<option class="citystr"+ value='+json[i]["name"]+'>'+json[i]['name']+'</option>';
                 }
                 $("#citys").html(text);
             }
         });

         //获取市级的名称
         $("#citys").bind("change",function () {
            var name = $(this).val();
             $.ajax({
                 url: "{:url('casebase/casese')}",
                 data:{name:name},
                 type: 'GET',
                 dataType: 'json',
                 timeout: 1000,
                 cache: false,
                 beforeSend: LoadFunction, //加载执行方法
                 error: erryFunction,  //错误执行方法
                 success: succFunction //成功执行方法
             })
             function LoadFunction() {
                 $("#casebasetable").html('加载中...');
             }
             function erryFunction() {
                 alert("error");
             }
             function succFunction(data) {
                 $("#casebasetable").html(' ');
                 var json = eval(data); //数组
                 var text ='';
                 if(data == ''){
                     var text ='<td colspan="6">'+'没有更多的案件！'+'</td>';
                 }
                 for(var i=0;i<json.length;i++){
                     text+='<tr>\n' +
                         '                                <td>'+json[i]["catetype"]["title"]+'</td>\n' +
                         '                                <td>'+json[i]["bname"]+'</td>\n' +
                         '                                <td>'+json[i]["money"]+'</td>\n' +
                         '                                <td>'+json[i]["court"]+'</td>\n' +
                         '                                <td>'+json[i]["create_at"]+'</td>\n' +
                         '                                <td>'+json[i]["status"]+'</td>\n' +
                         '                                </tr>';
                 }
                 $("#casebasetable").html(text);
             }
         });

         //获取案件类型并查出
           $(".casebase-wraper-three-inner").on("click",".leixing",function () {
                  var ret = $(this).html();
                  window.location.href="{:url('casebase/index')}?ret="+ret;
           })

         });

 </script>
   {include file="public/footer" /}







